<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" %>
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
<!DOCTYPE html >
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>USER</title>
    <link rel="stylesheet" type="text/css"
          href="easyui/themes/bootstrap/easyui.css">
    <link rel="stylesheet" type="text/css" href="easyui/themes/icon.css">
    <script type="text/javascript" src="myjs/path.js"></script>
    <script type="text/javascript" src="easyui/jquery.min.js"></script>
    <script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="easyui/locale/easyui-lang-zh_CN.js"></script>
    <script src="js/yangshi.js"></script>

</head>
<body>
<shiro:lacksPermission name="vipcard:look">没有查询此模块权限。。。</shiro:lacksPermission>
<shiro:hasPermission name="vipcard:look">
    <div id="vipchongzhi">
        会员名称：<input id='huiyuanming' class="easyui-textbox" type="text"
                    data-options="" prompt="请输入会员名"> 电话号码：<input id='phone'
                                                                 class="easyui-textbox" type="text" data-options=""
                                                                 prompt="请输入电话号码">
        日期查询从: <input id="qtime" type="text" class="easyui-datebox"
                      data-options="editable:false" style="width: 120px"> 到: <input
            id="htime" type="text" class="easyui-datebox"
            data-options="editable:false" style="width: 120px"> <a
            id="btn" href="#" class="easyui-linkbutton" iconCls="icon-search"
            onclick="loadGrid()">搜索</a>
    </div>
    <table id="chongzhijilu"></table>
</shiro:hasPermission>
</body>
</html>
<script type="text/javascript">
    $(document).ready(function () {
        $('#huiyuanming').next('span').find('input').focus()
    });
    $(document).keyup(function (event) {
        if (event.keyCode == 13) {
            $("#chongzhijilu").datagrid({
                queryParams: {
                    huiyuanming: $("#huiyuanming").val(),
                    startTime: $("#qtime").val(),
                    endTime: $("#htime").val(),
                    phone: $("#phone").val()
                }
            })
        }
    });

    function loadGrid() {
        $("#chongzhijilu").datagrid({
            queryParams: {
                huiyuanming: $("#huiyuanming").val(),
                startTime: $("#qtime").val(),
                endTime: $("#htime").val(),
                phone: $("#phone").val()
            }
        })

    }

    var date = new Date();//Tue Jul 16 01:07:00 CST 2013的时间对象
    var year = date.getFullYear();//年
    var month = date.getMonth() + 1;//月份（月份是从0~11，所以显示时要加1）
    var day = date.getDate();//日期
    var end = year + '-' + month + '-' + day;
    var start = year + '-' + month + '-' + 1;
    //loadGrid(); // 页面进入调用查询方法
    $("#qtime").val(start);
    $('#htime').val(end);

    $("#chongzhijilu").datagrid({
        url: path + '/vip/chongzhilist.do',
        method: 'GET',
        toolbar: '#vipchongzhi',
        fit: true,
        striped: true,
        //fitColumns : true,
        singleSelect: true,
        queryParams: {
            huiyuanming: $("#huiyuanming").val(),
            startTime: $("#qtime").val(),
            endTime: $("#htime").val(),
            phone: $("#phone").val()
        },
        autoRowHeight: true,
        rownumbers: true,
        pagination: true,
        nowrap: false,
        pageSize: 20,
        pageList: [10, 20, 50],
        showFooter: true,
        loadMsg: '加载中,请稍后......',
        columns: [[{
            field: 'huiyuanming',
            title: '会员名称',
            width: 150,
            align: 'center'
        }, {
            field: 'phone',
            title: '电话号码',
            width: 150,
            align: 'center'
        }, {
            field: 'czmoney',
            title: '金额',
            width: 150,
            align: 'right',
            formatter: function (value, row, index) {
                return value.toFixed(2);
            }
        }, {
            field: 'createTime',
            title: '充值时间',
            width: 150,
            align: 'center'
        }, {
            field: 'chongzhiren',
            title: '充值人',
            width: 150,
            align: 'center'
        }, {
            field: 'leixing',
            title: '类型',
            width: 150,
            align: 'center',
            formatter: function (value, row, index) {
                if (value == 0) {
                    return "充值";
                } else if (value == 1) {
                    return "消费";
                } else {
                    return "退货";
                }
            }
        }]]
    })
</script>
